<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE HTML>
<html>
<head>
  <title>后台管理系统</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <link href="/resources/css/dpl-min.css" rel="stylesheet" type="text/css" />
  <link href="/resources/css/bui-min.css" rel="stylesheet" type="text/css" />
  <link href="/resources/css/page-min.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="container">

    <form id="searchForm" class="form-horizontal">
        <div class="row">
            <div class="control-group span8"  style="width:450px;">
                <label class="control-label"  style="width:80px;">申请时间：</label>
                <div class="controls"  style="width:350px;">
                    <input type="text" class="calendar calendar-time" name="startDate" id="startDate"><span> - </span><input name="endDate" id="endDate" type="text" class="calendar calendar-time">
                </div>
            </div>
            <div class="control-group span8">
                <label class="control-label">提现类型：</label>
                <div class="controls" >
                    <select name="type" id="type" >
                        <option value="">--全部--</option>
                        <option value="1">微信提现</option>
                        <option value="2">银行卡提现</option>
                    </select>
                </div>
            </div>
            <div class="control-group span8">
                <label class="control-label">申请状态：</label>
                <div class="controls" >
                    <select name="status" id="status" >
                        <option value="">--全部--</option>
                        <option value="0">待审核</option>
                        <option value="1">审核通过</option>
                        <option value="2">审核拒绝</option>
                    </select>
                </div>
            </div>

            <div class="span3 offset2">
                <button  type="button" id="btnSearch" class="button button-primary">搜索</button>
            </div>

        </div>
    </form>
    <br/>
    <div class="row">
        <div class="control-group span6">
        <label class="control-label">累计提现笔数：</label>
        <span id="ljtxbs">
            0
            </span>
        </div>

    <div class="control-group span6">
        <label class="control-label">累计提现金额：</label>
        <span  id="ljtxje">
            0
        </span>元
    </div>
    <div class="control-group span6">
        <label class="control-label">今日提现笔数：</label>
        <span id="jrtxbs">
            0
        </span>
    </div>
    <div class="control-group span6">
        <label class="control-label">今日提现金额：</label>
        <span id="jrtxje">
            0
        </span>元
    </div>
    </div>
    <div class="search-grid-container">
        <div id="grid"></div>
    </div>
</div>
<script type="text/javascript" src="/resources/js/jquery-1.8.1.min.js"></script>
<script type="text/javascript" src="/resources/js/bui-min.js"></script>
<script type="text/javascript" src="/resources/js/config-min.js"></script>
<script type="text/javascript">
    var store,gridCfg;
  BUI.use(['common/search','common/page','bui/grid','bui/overlay','bui/form'],function (Search,Page,Grid,Overlay,Form) {
    var  columns = [
              {title:'申请人',dataIndex:'userNickName',width:120},
              {title:'申请人账号',dataIndex:'userAccount',width:120},
              {title:'申请金额',dataIndex:'amount',width:100},
                {title:'提现类型',dataIndex:'type',width:100,renderer:function(val,obj){
                    if(obj.type=='1'){
                        return "微信提现";
                    }else if(obj.type=='2'){
                        return "银行卡提现";
                    }
                }},
              {title:'申请人类型',dataIndex:'userType',width:100,renderer:function(value,obj){
                  if(obj.userType=='Customer'){
                      return "普通用户";
                  }else if(obj.userType=='Gold'){
                      return "金牌代理";
                  }else if(obj.userType=='General'){
                      return "全国总代";
                  }else if(obj.userType=='Partner'){
                      return "区域合伙人";
                  }
              }},
              {title:'当前状态',dataIndex:'satus',width:120,renderer:function(value,obj){
                  if(obj.status=='0'){
                      return "待审核";
                  }else if(obj.status=='1'){
                      return "审核通过";
                  }else if(obj.status=='2'){
                    return "审核拒绝";
                  }
              }},
             {title:'申请时间',dataIndex:'dateStr',width:150},
              {title:'操作',dataIndex:'',width:200,renderer : function(value,obj){
                var editStr =  Search.createLink({ //链接使用 此方式
                          id : 'edit' + obj.id,
                          title : '查看',
                          text : '查看',
                          href : '/txApply/beforeEdit?id='+obj.id
                        });
                return editStr;
              }}
            ];
            store = Search.createStore('/txApply/listData');
            gridCfg = Search.createGridCfg(columns,{
              plugins : [BUI.Grid.Plugins.CheckSelection] // 插件形式引入多选表格
            });

  });

    function del(id){
        var msg = "确定删除该广告吗？";

        BUI.Message.Confirm(msg,function(){
            $.ajax({
                url :"/txApply/delete",
                type : 'post',
                data : {
                    id:id
                },
                success : function(data){
                    BUI.Message.Alert(data.msg,function(){
                        if(data.success){ //删除成功
                            top.topManager.reloadPage();
                        }
                    });
                }
            });
        },'question');
    }
    $(function(){
        loadData();
       $("#btnSearch").click(function(){
           loadData();
       }) ;
    });

    function loadData(){
        $.ajax({
            url:"/txApply/loadData?r="+Math.random(),
            type:"post",
            data:{
                startDate:$("#startDate").val(),
                endDate:$("#endDate").val(),
                status:$("#status").val(),
                type:$("#type").val()
            },
            success:function(res){
                if(res.success){
                    $("#ljtxje").html(res.data.ljtxje);
                    $("#ljtxbs").html(res.data.ljtxbs);
                    $("#jrtxje").html(res.data.jrtxje);
                    $("#jrtxbs").html(res.data.jrtxbs);
                }
            },
            error:function(){}
        })
    }
</script>
<script type="text/javascript" src="/views/js/list.js"></script>
</body>
</html>  
